#!/usr/bin/env python
# encoding: utf-8

import requests
import logging

HOST= 'http://192.168.0.10/api{}'
STAR_LIST_API = '/stars'


class HttpService(object):
    """http client to make requests with server."""
    def __init__(self):
        self.logger = logging.getLogger(__name__)

    def get_stars(self):
        r = requests.get(HOST.format(STAR_LIST_API))
        if r.status_code == 200:
            star_dict = r.json()
            return star_dict['data']
        else:
            self.logger.error('error to get stars from server.')
